The invention relates generally to a web server framework, and more particularly to server-side control objects that bidirectionally bind with properties of server-side data tables.
A typical web browser receives data from a web server that defines the appearance and rudimentary behavior of a web page for display on a client system. In a typical scenario, a user specifies a Uniform Resource Locator (xe2x80x9cURLxe2x80x9d), a global address of a resource on the World Wide Web, to access a desired web site. Generally, the term xe2x80x9cresourcexe2x80x9d refers to data or routines that can be accessed by a program. An example URL is xe2x80x9chttp://www.microsoft.com/ms.htmxe2x80x9d. The first part of the example URL indicates a given protocol (i.e., xe2x80x9chttpxe2x80x9d) to be used in the communication. The second part specifies the domain name (i.e., xe2x80x9cwww.microsoft.comxe2x80x9d) where the resource is located. The third part specifies the resource (i.e., a file called xe2x80x9cms.htmxe2x80x9d) within the domain. Accordingly, a browser generates an HTTP (HyperText Transport Protocol) request associated with the example URL to retrieve the data associated with ms.htm file within the www.microsoft.com domain. A web server hosting the www.microsoft.com site receives the HTTP request and returns the requested web page or resource in an HTTP response to the client system for display in the browser.
The xe2x80x9cms.htmxe2x80x9d file of the example above includes static HTML (HyperText Markup Language) code. HTML is a plain-text authoring language used to create documents (e.g., web pages) on the World Wide Web. As such, an HTML file can be retrieved from a web server and displayed as a web page in a browser to present the rich graphical experience that users have come to expect while viewing information from the Internet. Using HTML, a developer can, for example, specify formatted text, lists, forms, tables, hypertext links, inline images and sounds, and background graphics for display in the browser. An HTML file, however, is a static file that does not inherently support dynamic generation of web page content.
If dynamic content is to be displayed, such as a changing stock price or traffic information, a server-side application program is generally developed to handle the more complex client-server interaction. The server-side application program processes an HTTP request and generates the appropriate HTML code for transmission to the client in an HTTP response. An exemplary HTTP request may include parameters, such as data in a query string or data from web-based forms. As such, a server-side application program can process these parameters and dynamically generate HTML code for transmission in an HTTP response to the client. An exemplary server-side application program may generate documents containing appropriate HTML code using a sequence of one or more formatted text write operations to a memory structure. Thereafter, the resulting document is transmitted to a client system in an HTTP response, where it is displayed as a web page in the browser.
Developing a server-side application program can be a complex task requiring not only familiarity with normal HTML coding that is used to layout a Web page, but also with programming basics, including one or more programming languages (e.g., C++, Perl, Visual Basic, or Jscript). Web page designers, on the other hand, are frequently graphics designers and editors, who may lack programming experience. Furthermore, simplifying complex web page development can speed the development of new web content by any developer. Generally, development of a custom server-side application program also requires tremendous effort, so much, in fact, that developers are often disinclined to attempt it. It is desirable, therefore, to provide a development framework that allows a developer to dynamically create and process a web page with minimal programming.
One approach to minimize the programming requirements of dynamic web page generation has been the Active Server Page (ASP) framework, provided by Microsoft Corporation. An ASP resource typically includes Visual Basic or Jscript code, for example, to process an HTTP request that specifies the ASP resource as the desired resource and, thereafter, to generate the resulting HTML code in a HTTP response to the client. Furthermore, an ASP resource may reference pre-developed or third party client-side library components (e.g., client-side ACTIVEX controls) to ease a given application programming effort. However, in the current server-side application frameworks, the programming required to dynamically manage client-side user interface elements (e.g., text boxes, list boxes, buttons, hypertext links, images, sounds, etc.) within server-side applications can still require sophisticated programming skills and considerable effort. An unanswered problem exists in properly encapsulating programming required to process user interface elements, so as to allow the web page developer to focus on other aspects of the web page.
Certain client-side user interface elements include data associated with a server-side datastore, such as a database. An example of such an element may be a client-side table displaying a selection of products and prices from a server-side product database. Another example may include a text box in which a consumer can enter a shipping address to be stored to a server-side customer database for later use. Traditionally, the client-side user-interface elements are written into the page by a page developer, and an application program is written by an application program developer to perform the data communications between the page and the server-side databases. A problem is that both page developing and application program developing require significant development effort and intimate knowledge of the database structures and some level of complicated programming (e.g., through client-side scripting or server-side application programming).
In accordance with the present invention, the above and other problems are solved by providing hierarchical data binding between one or more server-side control objects and one or more server-side datastores. Hierarchical data binding is supported by automatically creating a binding container for each data object in a data array. Each binding container provides its children with access to its public properties, including the data objects of the server-side datastore with which it is associated. As such, the property of a server-side control object may be bound through its binding container to a property of a server-side datastore. A data binding relationship may be established, without limitation, unidirectionally from a property of the server-side control object to the property of the server-side datastore or vice versa. A data binding relation may also be established, without limitation, bidirectionally between a property of the server-side control object and the property of the server-side datastore.
In one implementation of the present invention, a method of data binding a property of a descendent server-side control object to a property of a data set (e.g., a table row) of a server-side data table having one or more data sets is provided in a server computer coupled to a client computer system. The descendent server-side control object corresponds to a client-side user interface element. An iterating control object iterates over each data set of the server-side data table to create a binding container server-side control object corresponding to each data set. Each binding container server-side control object is associated with a data set of the server-side data table. A descendent server-side control object is created for a property of each data set. A given descendent server-side control object is a descendent of the binding container server-side control object corresponding to a given data set and is associated with a property of the given data set. A data binding relationship is established between the property of the descendent server-side control object and the property of one of the data sets of the server-side data table.
In other implementations of the present invention, articles of manufacture are provided as computer program products. One embodiment of a computer program product provides a computer program storage medium readable by a computer system and encoding a computer program for executing a computer process data binding a property of a descendent server-side control object to a property of a server-side data array having one or more data objects is provided. Another embodiment of a computer program product may be provided in computer data signal embodied in a carrier wave by a computing system and encoding the computer program. The child server-side control object corresponds to a client-side user interface element. The server-side data array is loaded from a server-side database. An iterating server-side control object is associated with the server-side data table and is created into a server-side control object hierarchy. The server-side data array is stored as a property of the iterating server-side control object. A binding container server-side control object corresponding to one of the data objects is created as a child of the iterating server-side control object. The binding container server-side control object is associated with one of the data objects of the server-side data array. A descendent server-side control object is created for each property of each data object. Each descendent server-side control object is a descendent of the binding container server-side control object. A data binding relationship is established between the property of the descendent server-side control object and the property of the server-side data array.
In another implementation, a server for performing server-side data binding using a hierarchy of server-side control objects corresponding to client-side user interface elements is also provided, including a server-side data array having one or more data objects. Each data object may include a property. An iterating server-side control object in a server-side control object hierarchy is associated with the server-side data array. One or more binding container server-side control objects are iteratively created by the iterating server-side control object based on a number of data objects in the server-side data array. One or more descendent server-side control objects corresponds to a property of each data object of the server-side data array. Each descendent server-side control is created as a descendent of the binding control server-side control object of a given data object in the server-side data array. A data binding relationship structure describes a data binding relationship between a property of the descendent control object and the property of the data object of the server-side data array.